package com.l024.framework.utils;

import android.app.Activity;
import android.graphics.Color;
import android.os.Build;
import android.view.View;

/**
 * @author wu_ming_zhi_bei
 * @date 2020/2/22 21:05
 * @Notes 沉浸式状态栏
 */
public class SystemUI {
    public static void fixSystemUI(Activity activity){
        //android5.0以上
        if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){
            activity.getWindow().getDecorView()
                    .setSystemUiVisibility(
                            //全屏
                            View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN|
                            //显示状态栏
                            View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                            //隐藏状态栏
                            //View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                    );
            //隐藏标题栏 不常用，一般直接给Activity设置主题@style/Theme.AppCompat.Light.NoActionBar
            //getSupportActionBar().hide();
            //设置状态栏透明色
            activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
        }
    }
}
